<%@page contentType="text/html;charset=utf-8"%>
<%@include file="../../core/common.jsp"%>
<html>
<head>
<title></title>
</head>
<body>
	<div id="tb" class="toolbar">
		<div style="float: left;">
			<shiro:hasPermission name="ck:insert">
				<a id="insert" class="form-btn primary">
					<i class="fa fa-plus m-r-5"></i>添加
				</a>
			</shiro:hasPermission>
			<shiro:hasPermission name="ck:kq">
				<a id="kq" class="form-btn primary">
					<i class="fa fa-list-ol m-r-5"></i>库区
				</a>
			</shiro:hasPermission>
			<shiro:hasPermission name="ck:delete">
				<a id="delete" class="form-btn danger">
					<i class="fa fa-trash-o m-r-5"></i>删除
				</a>
			</shiro:hasPermission>
		</div>
		<div style="float: right;">
			<a id="find" class="form-btn success">
				<i class="fa fa-refresh m-r-5"></i>刷新
			</a>
		</div>
		<div style="clear: both;"></div>
	</div>
	<table id="dg" class="easyui-datagrid" data-options="url:'${CTX}/mgt/t/ck/find',toolbar:'#tb'">
		<thead>
			<tr>
				<th data-options="field:'ckmc',width:150">仓库名称</th>
				<th data-options="field:'ggxh',width:150">规格型号</th>
				<th data-options="field:'kqsl',width:150">库区数量</th>
				<th data-options="field:'kqks',width:150">库区捆数</th>
				<th data-options="field:'rkzl',width:150">入库重量(T)</th>
				<th data-options="field:'cksx',width:150">仓库顺序</th>
			</tr>
		</thead>
	</table>
</body>
<script>
	$(function() {
		$('#find').click(function() {
			$('#dg').datagrid('reload');
		});
		$('#insert').click(function() {
			$.open({
				title : $(this).html(),
				url : '${CTX}/mgt/t/ck/insert',
				end : function() {
					$('#find').click();
				}
			});
		});
		$('#kq').click(function() {
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				$.open({
					title : $(this).html(),
					url : '${CTX}/mgt/t/ck/kq?ckmc=' + row.ckmc
				});
			} else {
				$.info('请选择仓库');
			}
		});
		$('#delete').click(function() {
			var row = $('#dg').datagrid('getSelected');
			if (row) {
				$.confirm('确定删除仓库', function() {
					$.mask();
					$.ajax({
						url : '${CTX}/mgt/t/ck/delete',
						data : {
							id : row.ckmc
						},
						success : function(data) {
							$.unmask();
							$.handle(data, function() {
								$('#find').click();
							});
						}
					});
				});
			} else {
				$.info('请选择仓库');
			}
		});
	});
</script>
</html>